package com.wkk.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

 /**
   *
   * @author : WangKeKe
   * @date : 2020/8/13 17:50
   * Description : MybatisPlus配置类
   *
 */


 @Configuration
 @MapperScan("com.wkk.*.mapper")
 @EnableTransactionManagement
 public class MybatisPlusConfig {

     /** 乐观锁插件 配置 **/
     @Bean
     public OptimisticLockerInterceptor optimisticLockerInterceptor() {
         return new OptimisticLockerInterceptor();
     }

     /** 分页插件 配置 （内部还能进行其他配置详情查看官方文档）**/
     @Bean
     public PaginationInterceptor paginationInterceptor() {
         return new PaginationInterceptor();
     }
 }
